//
//  ZH_OrderStateTwoTableViewCell.m
//  WisdomStar
//
//  Created by zhangliwen on 2018/10/27.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZH_OrderStateTwoTableViewCell.h"
@interface ZH_OrderStateTwoTableViewCell()
@property (nonatomic,weak)UILabel *leftLabel;
@property (nonatomic,weak)UILabel *centerLabel;
@end
@implementation ZH_OrderStateTwoTableViewCell

///创建
+(instancetype)cellWithTableView:(UITableView*)tableView
{
    static NSString *ID = @"ZH_OrderStateTwoTableViewCell";
    ZH_OrderStateTwoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if(cell == nil){
        cell = [[ZH_OrderStateTwoTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
}
///初始化
-(void)initDefault
{
    [self unShowClickEffect];
    //    self.bottomShortLineImage.hidden = NO;
}
- (void)loadSubviewConstraints{
    [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(FITSCALE(11));
        make.top.equalTo(self.contentView).offset(FITSCALE(15));
        make.bottom.equalTo(self.contentView).offset(FITSCALE(-15));
    }];
    [self.centerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.contentView).offset(FITSCALE(-11));
    }];
   
}
#pragma mark - getter,setter
- (UILabel *)leftLabel{
    if (!_leftLabel) {
        UILabel *label = [UILabel createLabelWithText:@"共计1件商品" font:kFontSize_24];
        [self.contentView addSubview:_leftLabel = label];
    }
    return _leftLabel;
}
- (UILabel *)centerLabel{
    if (!_centerLabel) {
        UILabel *label = [UILabel createLabelWithText:@"合计:100元" font:kFontSize_24];
        label.textColor = [UIColor colorWithHexString:@"#333333"];
        label.textAlignment = NSTextAlignmentRight;
        NSMutableAttributedString *attr = [[NSMutableAttributedString alloc]initWithString:label.text];
        NSDictionary *dic = @{NSFontAttributeName:kFontSize_26,NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#F0302F"]};
        [attr setAttributes:dic range:[label.text rangeOfString: @"100元"]];
        label.attributedText = attr;
        [self.contentView addSubview:_centerLabel = label];
    }
    return _centerLabel;
}
@end
